#ifndef GAMEANIMATIONCOLLECTION_H
#define GAMEANIMATIONCOLLECTION_H

#include <QObject>
#include <QPointF>
#include <QAnimationGroup>
#include <QParallelAnimationGroup>
#include <QSequentialAnimationGroup>
#include <QPropertyAnimation>
#include <QEventLoop>
#include "gs.h"

using namespace gs;

namespace gs
{

class GameSeqAnimation : public QSequentialAnimationGroup
{
    Q_OBJECT
public:
    GameSeqAnimation(QObject* parent);
    void addMove(QObject* target, QPointF moveS, QPointF moveE, int duration);
    void addFade(QObject* target, qreal fadeS, qreal fadeE, int duration, QEasingCurve = QEasingCurve::Linear);
    void addRotation(QObject* target, qreal rotS, qreal rotE, int duration, bool loop);
    void startUntilStop(QAbstractAnimation::DeletionPolicy);
protected:
    QEventLoop e;
protected slots:
    void release();
};

class GameParAnimation:public QParallelAnimationGroup
{
    Q_OBJECT
public:
    GameParAnimation(QObject* parent);
    void addMove(QObject* target, QPointF moveS, QPointF moveE, int duration);
    void addFade(QObject* target, qreal fadeS, qreal fadeE, int duration);
    void addScale(QObject* target, qreal scaleS, qreal scaleE, int duration);
    void addRotation(QObject* target, qreal rotS, qreal rotE, int duration, bool loop);
    void startUntilStop(QAbstractAnimation::DeletionPolicy = KeepWhenStopped);

protected:
    QEventLoop e;
protected slots:
    void release();
};
}
#endif // GAMEANIMATIONCOLLECTION_H
